using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using PluginHandler.UI;
using Npgsql;

namespace NpgsqlPlugin.UI
{
    public partial class ConnectionDetails : UserControl, IConnectionDetails
    {
        private NpgsqlConnection _connection;

        public ConnectionDetails()
        {
            InitializeComponent();
        }

        #region IConnectionDetails Member

        public IDbConnection DatabaseConnection
        {
            get
            {
                return _connection;
            }
            set
            {
                _connection = (NpgsqlConnection)value;

                txtHost.Text = _connection.Host;
                txtServerVersion.Text = _connection.ServerVersion.ToString();
                txtDatabase.Text = _connection.Database;
                txtState.Text = _connection.State.ToString();
                txtConnectionString.Text = _connection.ConnectionString;
            }
        }

        #endregion
    }
}
